<%@ page language="java" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/commons/jsp/taglibs.jsp" %>
<%@taglib uri="http://www.framework.com/taglib" prefix="frame" %>
<head>
    <title>公共平台 </title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <!-- 样式文件的引入 -->
    <link href="${ctx}/commons/css/style.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/icon.css">
    <!-- jqueryUI JS文件的引入 -->
    <script type="text/javascript" src="${ctx}/commons/js/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="${ctx}/commons/js/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="${ctx}/commons/js/easyui-extends-validate.js"></script>
    <!-- jqueryUI国际化 -->
    <script type="text/javascript" src="${ctx}/commons/js/easyui-lang-zh_CN.js"></script>
    <!-- 开发使用的公用js方法 -->
    <script type="text/javascript" src="${ctx}/commons/js/common.js"></script>
    <!-- 开发国际化的引用，主要完成后台信息在前台提示的国际化，一定要放在最后 -->
    <script type="text/javascript">var ctx = '${ctx}';
    var actionExt = "action";
    var i18n = new Object();</script>
    <script src="${ctx}/commons/js/i18n/message_zh_CN.js" type="text/javascript"></script>
</head>

<body>
<div class="easyui-layout" data-options="fit:true,border:false">
    <div data-options="region:'north',border:false" style="padding: 4px;height: 80px;overflow: hidden;">
        <div class="easyui-panel" data-options="fit:true,border:true">
            <div class="queryContent">
                <form name="searchProjectsForm" id="searchProjectsForm" method="post" action="" style="display: none; ">
                    <table class="queryTable">
                        <tbody>
                        <tr>
                            <th>项目名称</th>
                            <td width="10%">
                                <input id="auctionName" class="easyui-validatebox" type="text" name="auctionName"
                                       maxlength="50"
                                       style="width:120px;height: 15px;"/>
                            </td>
                            <th>项目编号</th>
                            <td>
                                <input id="code" class="easyui-validatebox" type="text" name="code" maxlength="20"
                                       style="width:120px;height: 15px;"/>
                            </td>
                            <th>项目类型</th>
                            <td width="10%">
                                <select class="easyui-combobox" name="catagoryId" style="width:120px;height: 25px;"
                                        maxlength="20" data-options="">
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${projectTypeList}" var="type">
                                        <option value="${type.id}">${type.name}</option>
                                    </c:forEach>
                                </select>
                            </td>
                            <!--
										<th >资金来源</th>
									<td>
									 	<select id="moneySource" style="width:120px" class="easyui-combobox" name="moneySource">
									 		<option value="">--请选择--</option>
											<c:forEach items="${frame:dictChildren('moneySource')}" var="type">
												<option value="${type.value}">${type.name}</option>
											</c:forEach>
										</select>
									</td>
									 -->
                            <th>状态</th>
                            <td>
                                <select id="status" style="width:120px;height: 25px;" class="easyui-combobox"
                                        name="status">
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${frame:dictChildren('proj_status')}" var="type">
                                        <option value="${type.value}">${type.name}</option>
                                    </c:forEach>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th>创建时间</th>
                            <td>
                                <input id="startTime" class="easyui-datebox" type="text" name="startTime"
                                       data-options="validType:['dateTimeLessCompare[\'stopTime\']']" maxlength="20"
                                       style="width:120px;height: 25px;"/>-<input id="stopTime" class="easyui-datebox"
                                                                                  type="text"
                                                                                  data-options="validType:['dateTimeMoreCompare[\'startTime\']']"
                                                                                  name="stopTime" maxlength="20"
                                                                                  style="width:120px;height: 25px;"/>
                            </td>
                            <th>开标时间</th>
                            <td>
                                <input id="startTime" class="easyui-datebox" type="text" name="bidTime"
                                       data-options="validType:['dateTimeLessCompare[\'stopTime\']']" maxlength="20"
                                       style="width:120px;height: 25px;"/>-<input id="stopTime" class="easyui-datebox"
                                                                                  type="text"
                                                                                  data-options="validType:['dateTimeMoreCompare[\'startTime\']']"
                                                                                  name="bidStopTime" maxlength="20"
                                                                                  style="width:120px;height: 25px;"/>
                            </td>
                            <!--
									<th>预算金额(元)</th>
									<td>
									 	<input id="startMoney" class="easyui-validatebox" type="text" name="startMoney"  data-options="validType:['rangeLessCompare[\'endMoney\']']" maxlength="20" style="width:120px"/>-<input id="endMoney" class="easyui-validatebox" type="text"  data-options="validType:['rangeMoreCompare[\'startMoney\']']" name="endMoney" maxlength="20" style="width:120px"/>
									</td>
									-->
                            <th></th>
                            <td align="right" colspan="3">
                                <a href="javascript:void(0);" class="easyui-linkbutton" id="searchNBProjects"
                                   iconcls="icon-search" plain="true">查询</a>
                                <a href="javascript:void(0);" class="easyui-linkbutton" id="resetsearchNBProjects"
                                   iconcls="icon-reset" plain="true">清空</a>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </form>
            </div>
        </div>
    </div>

    <div data-options="region:'center',border:false" style="padding: 4px; height: 100%" id="listNBProjectsTableDiv">
        <div style="background-color: #FAFAFA">
            <c:if test="${isShowCreateButton }">
                <a href="javascript:void(0);" onclick="openDataDialog(projectsParamObj);" class="easyui-linkbutton"
                   iconCls="icon-add" plain="true">添加</a>
            </c:if>
        </div>
        <table id="listProjectsTable" class="easyui-datagrid" style="border: 1px solid black; height: 95%"
               data-options="singleSelect:false,toolbar:'#goodstb',method:'post',rownumbers:true,fitColumns:true,border:true,
						pagination:true,multiSort:true,remoteSort:true,striped:true,onLoadSuccess:function(data){$('#'+projectsParamObj.searchID).attr('disabled',false);},
						url:'${ctx}/auction/business/list?roleId=buyer'" }>
            <thead>
            <tr>
                <th data-options="field:'auctionName',width:170,title:'项目名称',sortable:true" align="center"></th>
                <th data-options="field:'code',width:90,title:'项目编号',sortable:true" align="center"></th>
                <th data-options="field:'catagoryName',width:80,title:'项目类型',sortable:true" align="center"></th>
                <th data-options="field:'ownerName',width:120,title:'产权人',sortable:true" align="center"></th>
                <th data-options="field:'auditName',width:100,title:'中心审核人',sortable:true" align="center"></th>
                <th data-options="field:'createTime',width:100,title:'创建时间',sortable:true" align="center"></th>
                <th data-options="field:'entryStart',width:100,title:'报名时间',sortable:true" align="center"></th>
                <th data-options="field:'auctionStart',width:80,title:'竞拍开始时间 ',sortable:true" align="center"></th>
                <th data-options="field:'statusName',width:80,title:'状态',sortable:true" align="center"></th>
                <th data-options="field:'operation',width:160,title:'操作'" align="center"></th>
            </tr>
            </thead>
        </table>
    </div>
</div>

<div id="bindPicDialog"></div>
<div id="selPicDialog"></div>
<div id="noCompetReasonDialog"></div>
</body>
<script type="text/javascript">
    jQuery(function ($) {
        // 备份jquery的ajax方法
        var _ajax = $.ajax;
        // 重写ajax方法，
        $.ajax = function (opt) {
            var _success = opt && opt.success || function (a, b) {
            };
            var _error = opt && opt.error || function (a, b) {
            };
            var _opt = $.extend(opt, {
                success: function (data, textStatus) {
                    // 如果后台将请求重定向到了登录页，则data里面存放的就是登录页的源码，这里需要判断(登录页面一般是源码，所以这里只判断是否有html标签)
                    if (data == "unLogin") {
                        top.location = '${ctx}/user-login-sys-new/loginPwd';
                        return;
                    }
                    _success(data, textStatus);
                },
                error: function (data, textStatus) {
                    if (data == "unLogin") {
                        top.location = '${ctx}/user-login-sys-new/loginPwd';
                        return;
                    }
                    _error(data, textStatus);
                }
            });
            return _ajax(_opt);
        };
    });


    //初始化表格对应的js对象
    var projectsParamObj;
    $(function () {
        //初始化表格对象数据"searchNBProjectsForm"
        projectsParamObj = new initParams(
            {
                paramObjName: 'projectsParamObj',//表格对应的实体对象名称，好区分多个表格情况下的对象
                tableId: 'listProjectsTable',
                addDataFormId: 'addProjectsDataForm',
                showDialogId: 'firstLevelDialog',
                searchID: 'searchNBProjects',
                resetSearchID: 'resetsearchNBProjects',
                searchFormID: 'searchProjectsForm',
                updateUrl: "${ctx}/auction/business/input?projectId=",
                deleteUrl: '${ctx}/business/projectmanage/remove',
                addDialogWidth: 1000,
                addDialogHeight: 650,
                ctx: '${ctx}',
                addDialogTitle: '产权项目信息'
            });
        //初始化查询
        init(projectsParamObj);

    });

    /**
     * 操作按钮处理
     * @param {Object} value
     * @param {Object} row
     * @param {Object} index
     */
    function getOptionsBtn(value, row, index) {
        var btnsHtml = "<span class='optionBtnsArea'>";
        var doSubmitHtml = '<a href="javascript:void(0)" onclick="doSubmit(\'' + row.id + '\')" class="">提交</a>&nbsp;';
        var toUpdateHtml = '<a href="javascript:void(0)" onclick="openDataDialog(projectsParamObj,\'' + row.id + '\')" class="">修改</a>&nbsp;';
        var callBackHtml = '<a href="javascript:void(0)" onclick="doCallback(\'' + row.id + '\')" class="">撤回</a>&nbsp;';
        var infoViewHtml = '<a href="javascript:void(0)" onclick="getProjectDetail(\'' + row.id + '\')" class="">项目详情</a>&nbsp;';
        var cancelHtml = '<a href="javascript:void(0)" onclick="doCancel(\'' + row.id + '\')" class="">撤销</a>&nbsp;';
        var uploadContractHtml = '<a href="javascript:void(0)" onclick="uploadContract(\'' + row.id + '\')" class="">上传合同</a>&nbsp;';
        btnsHtml += doSubmitHtml;
        btnsHtml += toUpdateHtml;
        btnsHtml += callBackHtml;
        btnsHtml += cancelHtml;
        btnsHtml += infoViewHtml;

        return btnsHtml + "</span>";
    }


    /**
     *提交
     **/
    function doSubmit(id) {
        top.$.messager.confirm('提示', "您确认要提交吗？", function (result) {
            if (result) {
                $.ajax({
                    type: "post",
                    url: "${ctx}/auction/business/doSubmit",
                    data: 'id=' + id,
                    success: function (data, res) {
                        var result = $.trim(res.responseText);
                        if (result == "unLogin") {
                            var msn = '' || i18n[''];
                            msn = msn || i18n[result];
                            if (msn != undefined) {
                                top.$.messager.alert('提示', msn, 'info', function () {
                                    top.location = '${ctx}/user-login-sys-new/loginPwd';
                                });
                                return;
                            }
                        }
                        top.$.messager.alert("提示", '提交成功', 'info', function () {
                            $('#listProjectsTable').datagrid('reload');
                        });

                    },
                    error: function (res) {
                        top.$.messager.alert('提示', i18n.requestError, 'error');
                    }
                });
            }
        });
        return;
    }

    /**
     * 撤回项目操作
     */
    function doCallback(id) {
        $.messager.confirm('提示', "你确定对该记录进行撤回吗？", function (result) {
            if (result) {
                top.$('#firstLevelDialog').dialog({
                    title: "撤回原因",
                    iconCls: 'icon-view',
                    width: '600',
                    height: '400',
                    closed: false,
                    inline: true,
                    cache: false,
                    href: "${ctx}/business/projectmanage/getCancelReson?projectId=" + id,
                    modal: true,
                    close: afterClosed,
                    extractor: function (data) {
                        if ($.trim(data) == "unLogin") {
                            var msn = '' || i18n[''];
                            msn = msn || i18n[data];
                            if (msn != undefined) {
                                top.$.messager.alert('提示', msn, 'info', function () {
                                    top.location = '${ctx}/user-login-sys-new/loginPwd';
                                });
                                return '';
                            }
                        }
                        return data;
                    },
                    buttons: [{
                        text: '保存',
                        iconCls: 'icon-ok',
                        handler: function () {
                            if (top.$('#addApproveResonForm').form('validate')) {
                                var cancelReason = top.$("#cancelReason").val();
                                if (cancelReason == null || $.trim(cancelReason) == '') {
                                    top.$.messager.alert('提示', "请输入原因！", 'info');
                                    return;
                                }
                                $.ajax({
                                    type: "POST",
                                    timeout: 20000,
                                    url: "${ctx}/business/projectmanage/callback",
                                    data: top.$('#addCancelResonForm').serialize(),
                                    success: function (data) {
                                        if (data == "success") {
                                            top.$.messager.alert("提示", '撤回成功', 'info', function () {
                                                $('#listProjectsTable').datagrid('reload');
                                                top.$('#firstLevelDialog').dialog('close');
                                                //top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                                            });
                                        } else {
                                            top.$.messager.alert('提示', "撤回失败！", 'info');
                                        }
                                    },
                                    error: function (res) {

                                    }
                                });
                            }
                        }

                    }
                        , {
                            text: '取消',
                            iconCls: 'icon-cancel',
                            handler: function () {
                                top.$('#firstLevelDialog').dialog('close');
                            }
                        }],
                    onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                        //alert(2);
                        top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                        afterClosed();
                    }
                });
                top.$('#firstLevelDialog').dialog("center");
            }
        });
    }

    /**
     * 撤销项目操作
     */
    function doCancel(id) {
        $.messager.confirm('提示', "你确定对该记录进行撤销吗？", function (result) {
            if (result) {
                top.$('#firstLevelDialog').dialog({
                    title: "撤销原因",
                    iconCls: 'icon-view',
                    width: '600',
                    height: '400',
                    closed: false,
                    inline: true,
                    cache: false,
                    href: "${ctx}/business/projectmanage/getCancelReson?projectId=" + id,
                    modal: true,
                    close: afterClosed,
                    extractor: function (data) {
                        if ($.trim(data) == "unLogin") {
                            var msn = '' || i18n[''];
                            msn = msn || i18n[data];
                            if (msn != undefined) {
                                top.$.messager.alert('提示', msn, 'info', function () {
                                    top.location = '${ctx}/user-login-sys-new/loginPwd';
                                });
                                return '';
                            }
                        }
                        return data;
                    },
                    buttons: [{
                        text: '保存',
                        iconCls: 'icon-ok',
                        handler: function () {
                            if (top.$('#addApproveResonForm').form('validate')) {
                                var cancelReason = top.$("#cancelReason").val();
                                if (cancelReason == null || $.trim(cancelReason) == '') {
                                    top.$.messager.alert('提示', "请输入原因！", 'info');
                                    return;
                                }
                                $.ajax({
                                    type: "POST",
                                    timeout: 20000,
                                    url: "${ctx}/business/projectmanage/saveCancel",
                                    data: top.$('#addCancelResonForm').serialize(),
                                    success: function (data, res) {
                                        if (data == 'success') {
                                            top.$.messager.alert("提示", '撤销成功', 'info', function () {
                                                top.$('#firstLevelDialog').dialog('close');
                                                top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                                                $('#listProjectsTable').datagrid('reload');
                                            });
                                        } else {
                                            top.$.messager.alert('提示', "撤销失败！", 'info');
                                        }
                                    },
                                    error: function (res) {

                                    }
                                });
                            }
                        }

                    }
                        , {
                            text: '取消',
                            iconCls: 'icon-cancel',
                            handler: function () {
                                top.$('#firstLevelDialog').dialog('close');
                            }
                        }],
                    onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                        //alert(2);
                        top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                        afterClosed();
                    }
                });
                top.$('#firstLevelDialog').dialog("center");
            }
        });
    }

    /**
     * 打开添加数据的页面的对话框(添加，修改)
     * @param {Object} paramObj ： 对应的列表对象
     * @param {Object} id ： 数据记录的ID
     * @param {Object} successcallback ：添加数据成功后的回调函数
     * @param {Object} failurecallback ： 添加数据失败后的回调函数
     */
    function openDataDialog(paramObj, id, successcallback, failurecallback) {
        if (id == undefined) {
            id = '';
        }
        var sign = false;
        top.$('#' + paramObj.showDialogId).dialog({
            title: paramObj.addDialogTitle,
            iconCls: 'icon-view',
            width: paramObj.addDialogWidth,
            height: paramObj.addDialogHeight,
            closed: false,
            inline: true,
            cache: false,
            href: paramObj.updateUrl + id,
            modal: true,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = paramObj.ctx + '/manage';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{
                text: '提交',
                id: 'commitEntityBt',
                iconCls: 'icon-ok',
                handler: function () {
                    if (top.$('#addProjectsDataForm').form('validate')) {
                        //top.$('#commitEntityBt').linkbutton('disable');
                        //top.$('#addEntityBt').linkbutton('disable');
                        submitEntity(paramObj, 'saveEntityBt', 20);
                    }

                }//增加保存按钮
            }, {
                text: '保存',
                id: 'addEntityBt',
                iconCls: 'icon-save',
                handler: function () {
//							top.$('#addEntityBt').linkbutton('disable');
//							top.$('#commitEntityBt').linkbutton('disable');
                    saveEntity(paramObj, 'addEntityBt', 10);

                }
            }, {
                text: paramObj.cancelButton,//取消
                iconCls: 'icon-cancel',
                handler: function () {
                    top.$('#' + paramObj.showDialogId).dialog('close');
                }
            }],
            onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                 top.$("#otherUpload1").uploadify('destroy');//销毁文件上传对象....
                 top.$("#otherUpload2").uploadify('destroy');//销毁文件上传对象....
                 top.$("#otherUpload3").uploadify('destroy');//销毁文件上传对象....
                 top.$("#otherUpload4").uploadify('destroy');//销毁文件上传对象....
                 top.$("#otherUpload5").uploadify('destroy');//销毁文件上传对象....
                 top.$("#otherUpload6").uploadify('destroy');//销毁文件上传对象....
                 top.$("#otherUpload7").uploadify('destroy');//销毁文件上传对象....
                 top.$("#otherUpload8").uploadify('destroy');//销毁文件上传对象....
                 top.$("#otherUpload9").uploadify('destroy');//销毁文件上传对象....

                if (top.$('#' + paramObj.showDialogId).find("object").length > 0) {
                    var fileQueue = top.window.document.getElementById("fileQueue");
                    fileQueue.innerHTML = "";
                    fileQueue.parentNode.removeChild(fileQueue);
                }
                afterClosed();
            }
        });
        top.$('#' + paramObj.showDialogId).dialog("center");
    }

    /**
     *保存按钮操作
     **/
    function saveEntity(paramObj, opBtId, commitType) {
        //alert("保存操作");
        //保存项目
        $.ajax({
            type: "post",
            url: "${ctx}/auction/business/save?r=" + new Date().getTime(),
            data: top.$("#addProjectsDataForm").serialize(),
            dataType: "text",
            success: function (data) {
                var result = eval("(" + data + ")");
                //if(data=="success"){
                //top.$(".upload").uploadify('destroy');//销毁文件上传对象....
                top.$.messager.alert("提示", '保存成功', 'info', function () {
                    $('#listProjectsTable').datagrid('reload');
                    $('#listNBProjectsTable').datagrid('reload');
                    top.$('#firstLevelDialog').dialog('close');
                });

            },
            error: function (data) {
                alert("错误");
            }
        });
    }

    /**
     *提交按钮操作
     */
    function submitEntity(paramObj, opBtId, commitType) {
        //    if(validBudgetAmount()){
//			if(top.$('#'+paramObj.addDataFormId).form('validate')){//表单校验是否通过
//				var auditable=top.$('input:radio[name="auditable"]:checked').val();
//				if(auditable=='false'){
//					var manageLeader=top.$('#manageLeader').val();
//					if(manageLeader==''){
//						top.$.messager.alert("提示",'提交失败,分管领导不能为空！',"error");
//						return;
//					}
//					var manageName=top.$('#manageName').val();
//					if(manageName==''){
//						top.$.messager.alert("提示",'提交失败,项目负责人不能为空！',"error");
//						return;
//					}
//					var phoneNumber=top.$('#phoneNumber').val();
//					if(phoneNumber==''){
//						top.$.messager.alert("提示",'提交失败,手机号码不为空！',"error");
//						return;
//					}
//
//				}
//				var payType=top.$('#payType').val();
//				if(payType==''){
//					top.$.messager.alert("提示",'提交失败,付款方式不能为空！',"error");
//					return;
//				}
//				var buyContent=top.$('#buyContent').val();
//				if(buyContent==''){
//					top.$.messager.alert("提示",'提交失败,采购内容不能为空！',"error");
//					return;
//				}
        top.$('#commitEntityBt').linkbutton('disable');
        top.$('#addEntityBt').linkbutton('disable');
        $.ajax({
            type: "post",
            url: "${ctx}/auction/business/doSubmit?r=" + new Date().getTime(),
            data: top.$("#addProjectsDataForm").serialize(),
            success: function (data) {
                if (data == "success") {
                    //top.$(".upload").uploadify('destroy');//销毁文件上传对象....
                    top.$.messager.alert("提示", '提交成功', 'info', function () {
                        $('#listProjectsTable').datagrid('reload');
                        $('#listNBProjectsTable').datagrid('reload');
                        top.$('#firstLevelDialog').dialog('close');
                    });
                }
                else {
                    top.$.messager.alert("提示", '提交失败!');
                }
            },
            error: function (data) {
                alert("错误");
            }
        });
        //	}
        // }
    }

    /**
     *校验中标人是否缴纳履约保证金
     **/
    function uploadContract(id) {
        $.ajax({
            type: "POST",
            timeout: 20000,
            url: "${ctx}/business/projectmanage/public/validBidBond?id=" + id,
            data: {},
            success: function (data) {
                if (data == true) {
                    validBidBond(id);//打开上传合同页面
                } else {
                    top.$.messager.alert('提示', "中标人履约保证金未缴纳，请缴纳后再操作！", 'error');
                }
            },
            error: function (res) {

            }
        });
    }


    /**
     * 上传合同操作
     */
    function validBidBond(id) {
        top.$('#firstLevelDialog').dialog({
            title: "上传合同",
            iconCls: 'icon-view',
            width: '600',
            height: '400',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/business/projectmanage/uploadContract?projectId=" + id,
            modal: true,
            close: afterClosed,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{
                text: '提交',
                iconCls: 'icon-ok',
                id: 'commitEntityBt',
                handler: function () {
                    if (top.$("#budgetMenuData").val() == '') {
                        top.$.messager.alert('提示', "合同附件不能为空！", 'info', function () {
                        });
                        return;
                    }
                    top.$('#commitEntityBt').linkbutton('disable');
                    if (top.$('#addApproveResonForm').form('validate')) {
                        $.ajax({
                            type: "POST",
                            timeout: 20000,
                            url: "${ctx}/business/projectmanage/doSubmitContract",
                            data: top.$('#addCancelResonForm').serialize(),
                            success: function (data) {
                                if (data == "success") {
                                    top.$.messager.alert("提示", '提交成功', 'info', function () {
                                        $('#listProjectsTable').datagrid('reload');
                                        top.$('#firstLevelDialog').dialog('close');
                                        //top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                                    });
                                } else if (data == "noExecuteDeposit") {
                                    top.$.messager.alert('提示', "提交失败！未缴纳履约保证金！", 'info');
                                }
                                else {
                                    top.$.messager.alert('提示', "提交失败！合同上传失败，请重新上传！", 'info');
                                }
                            },
                            error: function (res) {

                            }
                        });
                    }
                }

            }
                , {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        top.$('#firstLevelDialog').dialog('close');
                    }
                }],
            onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                //alert(2);
                top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                afterClosed();
            }
        });
        top.$('#firstLevelDialog').dialog("center");
    }


    /**
     *项目详情
     */
    function getProjectDetail(id) {
        //alert(roleId);
        top.$('#firstLevelDialog').dialog({
            title: "项目详情",
            iconCls: 'icon-view',
            width: 1000,
            height: 580,
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/auction/business/getProjectDetail?projectId=" + id + "&roleId=buyer",
            modal: true,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{
                text: projectsParamObj.cancelButton,
                iconCls: 'icon-cancel',
                handler: function () {
                    top.$('#firstLevelDialog').dialog('close');
                }
            }]
        });
        top.$('#' + projectsParamObj.showDialogId).dialog("center");
    }


    //关闭
    function afterClosed() {
        // 在弹出对话框内找到Uploadify插件，并隐藏之。
        top.$.find('.upload').hide();
        // 将弹出对话框还原成弹出前的状态，并清空里面的内容。
        top.$('#firstLevelDialog').dialog('destroy').empty();
    }

    /**
     *采购确认操作
     **/
    function buyerSure(id, type) {
        debugger;
        $.ajax({
            type: "POST",
            timeout: 20000,
            url: "${ctx}/business/projectmanage/buyer/validateBuySure",
            success: function (data) {
                if (data) {
                    validateTimeOk(id, type);
                } else {
                    top.$.messager.alert('提示', "当前时间已超过16:30,无法进行确认！", 'error');
                }
            },
            error: function (res) {
                top.$.messager.alert('提示', i18n.requestError, 'error');
            }
        });
    }


    /**
     *校验成功后
     */
    function validateTimeOk(id, type) {
        $.messager.confirm('提示', "是否确认操作", function (result) {
            if (result) {
                top.$('#firstLevelDialog').dialog({
                    title: "确认操作",
                    iconCls: 'icon-view',
                    width: '600',
                    height: '220',
                    closed: false,
                    inline: true,
                    cache: false,
                    href: "${ctx}/business/projectmanage/getCancelReson?projectId=" + id + "&type=" + type,
                    modal: true,
                    close: afterClosed,
                    extractor: function (data) {
                        if ($.trim(data) == "unLogin") {
                            var msn = '' || i18n[''];
                            msn = msn || i18n[data];
                            if (msn != undefined) {
                                top.$.messager.alert('提示', msn, 'info', function () {
                                    top.location = '${ctx}/user-login-sys-new/loginPwd';
                                });
                                return '';
                            }
                        }
                        return data;
                    },
                    buttons: [{
                        text: '保存',
                        iconCls: 'icon-ok',
                        id: 'commitEntityBt',
                        handler: function () {
                            if (top.$('#addApproveResonForm').form('validate')) {
                                var cancelReason = top.$("#cancelReason").val();
                                if (type == 0) {
                                    if (cancelReason == null || $.trim(cancelReason) == '') {
                                        top.$.messager.alert('提示', "请输入原因！", 'info');
                                        return;
                                    }
                                }

                                top.$('#commitEntityBt').linkbutton('disable');

                                debugger;
                                if (type == "1") {//采购确认通过
                                    //显示加载数据
                                    loading();
                                }

                                $.ajax({
                                    type: "POST",
                                    timeout: 20000,
                                    url: "${ctx}/business/projectmanage/buyer/buyerSure",
                                    data: top.$('#addCancelResonForm').serialize(),
                                    success: function (data) {
                                        if (data == "success") {
                                            if (type == "1") {//采购确认通过
                                                top.$('#secondtLevelDialog').dialog('close');//关闭加载数据
                                            }
                                            top.$.messager.alert("提示", '提交成功', 'info', function () {
                                                $('#listProjectsTable').datagrid('reload');
                                                top.$('#firstLevelDialog').dialog('close');
                                                //top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                                            });
                                        } else if (data == "postbankfaill") {
                                            if (type == "1") {//采购确认通过
                                                top.$('#secondtLevelDialog').dialog('close');//关闭加载数据
                                            }
                                            top.$.messager.alert('提示', "推送投标保证金信息至银行失败，请联系系统管理员！", 'error');
                                            top.$('#firstLevelDialog').dialog('close');
                                            $('#listProjectsTable').datagrid('reload');
                                        } else if (data == "postbanexecutekfaill") {
                                            if (type == "1") {//采购确认通过
                                                top.$('#secondtLevelDialog').dialog('close');//关闭加载数据
                                            }
                                            top.$.messager.alert('提示', "推送履约保证金信息至银行失败，请联系系统管理员！", 'error');
                                            top.$('#firstLevelDialog').dialog('close');
                                            $('#listProjectsTable').datagrid('reload');
                                        } else if (data == "false") {
                                            top.$.messager.alert('提示', "当前时间已超过16:30,无法进行确认！", 'error');
                                        } else {
                                            if (type == "1") {//采购确认通过
                                                top.$('#secondtLevelDialog').dialog('close');//关闭加载数据
                                            }
                                            top.$.messager.alert('提示', "提交失败！", 'error');
                                            top.$('#firstLevelDialog').dialog('close');
                                            $('#listProjectsTable').datagrid('reload');

                                        }
                                    },
                                    error: function (res) {

                                    }
                                });
                            }
                        }

                    }
                        , {
                            text: '取消',
                            iconCls: 'icon-cancel',
                            handler: function () {
                                top.$('#firstLevelDialog').dialog('close');
                            }
                        }],
                    onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                        //alert(2);
                        top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                        afterClosed();
                    }
                });
                top.$('#firstLevelDialog').dialog("center");
            }
        });
    }

    //加载数据loading
    function loading() {
        top.$('#secondtLevelDialog').dialog({
            closable: false,
            title: '数据加载',
            width: '300',
            height: '180',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/commons/js/loading/loading.html",
            modal: true,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            }
        });
        top.$('#secondtLevelDialog').dialog("center");
    }

    /**
     *采购人补充资料
     **/
    function complete(id) {
        top.$('#firstLevelDialog').dialog({
            title: "确认操作",
            iconCls: 'icon-view',
            width: '600',
            height: '250',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/business/projectmanage/complete?projectId=" + id,
            modal: true,
            close: afterClosed,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{
                text: '保存',
                iconCls: 'icon-ok',
                handler: function () {
                    $.ajax({
                        type: "POST",
                        timeout: 20000,
                        url: "${ctx}/business/projectmanage/buyer/completeSave",
                        data: top.$('#addCancelResonForm').serialize(),
                        success: function (data) {
                            if (data == "success") {
                                top.$.messager.alert("提示", '提交成功', 'info', function () {
                                    $('#listProjectsTable').datagrid('reload');
                                    top.$('#firstLevelDialog').dialog('close');
                                    //top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                                });
                            } else {
                                top.$.messager.alert('提示', "提交失败！", 'info');
                            }
                        },
                        error: function (res) {

                        }
                    });
                }


            }
                , {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        top.$('#firstLevelDialog').dialog('close');
                    }
                }],
            onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                //alert(2);
                top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                afterClosed();
            }
        });
        top.$('#firstLevelDialog').dialog("center");

    }

    //===============================================================

    /*
     * 中标/流标确认操作
     **/
    function winBidSure(id) {
        $.messager.confirm('提示', "您确认结果吗？", function (result) {
            if (result) {
                loading();
                $.ajax({
                    type: "post",
                    url: "${ctx}/business/projectmanage/buyer/bidEndSure?id=" + id,
                    success: function (data, res) {
                        top.$('#secondtLevelDialog').dialog('close');//关闭加载数据
                        var result = $.trim(res.responseText);
                        if (result == "unLogin") {
                            var msn = '' || i18n[''];
                            msn = msn || i18n[result];
                            if (msn != undefined) {
                                top.$.messager.alert('提示', msn, 'info', function () {
                                    top.location = '${ctx}/user-login-sys-new/loginPwd';
                                });
                                return;
                            }
                        }
                        if (data == "postbanexecutekfaill") {
                            top.$.messager.alert('提示', "推送履约保证金信息至银行失败，请联系系统管理员！", 'error');
                        } else {
                            top.$.messager.alert("提示", '操作成功!', 'info', function () {
                                $('#listProjectsTable').datagrid('reload');
                            });
                        }
                    },
                    error: function (res) {
                        top.$('#secondtLevelDialog').dialog('close');//关闭加载数据
                        $.messager.alert('提示', i18n.requestError, 'error');
                    }
                });
            }
        });
    }

    /*
     * 结项确认操作
     **/
    function projectEndSure(id) {
        $.messager.confirm('提示', "您确认结项吗？", function (result) {
            if (result) {
                $.ajax({
                    type: "post",
                    url: "${ctx}/business/projectmanage/buyer/projectEndSure?id=" + id,
                    success: function (data, res) {
                        var result = $.trim(res.responseText);
                        if (result == "unLogin") {
                            var msn = '' || i18n[''];
                            msn = msn || i18n[result];
                            if (msn != undefined) {
                                top.$.messager.alert('提示', msn, 'info', function () {
                                    top.location = '${ctx}/user-login-sys-new/loginPwd';
                                });
                                return;
                            }
                        }
                        top.$.messager.alert("提示", '操作成功!', 'info', function () {
                            $('#listProjectsTable').datagrid('reload');
                        });

                    },
                    error: function (res) {
                        $.messager.alert('提示', i18n.requestError, 'error');
                    }
                });
            }
        });
    }


    /**
     * 上传验收报告
     */
    function receivingReport(id) {
        top.$('#firstLevelDialog').dialog({
            title: "上传验收报告",
            iconCls: 'icon-view',
            width: '600',
            height: '300',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/business/projectmanage/buyer/receivingReport?projectId=" + id,
            modal: true,
            close: afterClosed,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{
                text: '提交',
                iconCls: 'icon-ok',
                id: 'commitEntityBt',
                handler: function () {
                    if (top.$("#budgetMenuData").val() == '') {
                        top.$.messager.alert('提示', "报告附件不能为空！", 'info', function () {
                        });
                        return;
                    }
                    top.$('#commitEntityBt').linkbutton('disable');
                    if (top.$('#addApproveResonForm').form('validate')) {
                        $.ajax({
                            type: "POST",
                            timeout: 20000,
                            url: "${ctx}/business/projectmanage/uploadReceivingReport",
                            data: top.$('#addCancelResonForm').serialize(),
                            success: function (data) {
                                if (data == "success") {
                                    top.$.messager.alert("提示", '提交成功', 'info', function () {
                                        $('#listProjectsTable').datagrid('reload');
                                        top.$('#firstLevelDialog').dialog('close');
                                        //top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                                    });
                                } else {
                                    top.$.messager.alert('提示', "提交失败！", 'info');
                                }
                            },
                            error: function (res) {

                            }
                        });
                    }
                }

            }
                , {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        top.$('#firstLevelDialog').dialog('close');
                    }
                }],
            onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                //alert(2);
                top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                afterClosed();
            }
        });
        top.$('#firstLevelDialog').dialog("center");
    }


    /**
     * 终止项目
     */
    function cancleProject(id) {
        top.$('#firstLevelDialog').dialog({
            title: "终止项目",
            iconCls: 'icon-view',
            width: '600',
            height: '400',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/business/projectmanage/bizmanager/canclePage?projectId=" + id,
            modal: true,
            close: afterClosed,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{
                text: '提交',
                iconCls: 'icon-ok',
                id: 'commitEntityBt',
                handler: function () {
                    if (top.$("#cancelReason").val() == '') {
                        top.$.messager.alert('提示', "请填写原因！", 'info', function () {
                        });
                        return;
                    }
//												if(top.$("#budgetMenuData").val()==''){
//													top.$.messager.alert('提示',"附件不能为空！",'info',function(){});
//													return;
//												}
                    top.$('#commitEntityBt').linkbutton('disable');

                    if (top.$('#addApproveResonForm').form('validate')) {
                        $.ajax({
                            type: "POST",
                            timeout: 20000,
                            url: "${ctx}/business/projectmanage/bizmanager/closeProject",
                            data: top.$('#addCancelResonForm').serialize(),
                            success: function (data) {
                                if (data == "delSuccess") {
                                    top.$.messager.alert("提示", '终止成功', 'info', function () {
                                        $('#listProjectsTable').datagrid('reload');
                                        $('#listNBProjectsTable').datagrid('reload');
                                        top.$('#firstLevelDialog').dialog('close');
                                        //top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                                    });
                                } else {
                                    top.$.messager.alert('提示', "终止失败！", 'info');
                                }
                            },
                            error: function (res) {

                            }
                        });
                    }
                }

            }
                , {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        top.$('#firstLevelDialog').dialog('close');
                    }
                }],
            onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                //alert(2);
                top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                afterClosed();
            }
        });
        top.$('#firstLevelDialog').dialog("center");
    }


    //打开业务管理员变更项目编号页面
    function editProjectCode(id) {
        top.$('#firstLevelDialog').dialog({
            title: "修改编号",
            iconCls: 'icon-view',
            width: '300',
            height: '200',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/business/projectmanage/bizmanager/projectCodeInput?projectId=" + id,
            modal: true,
            close: afterClosed,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{
                text: '提交',
                iconCls: 'icon-ok',
                id: 'commitEntityBt',
                handler: function () {
                    if (top.$('#addProjectsDataForm').form('validate')) {
                        $.ajax({
                            type: "POST",
                            timeout: 20000,
                            url: "${ctx}/business/projectmanage/bizmanager/doSubmitProjectCode",
                            data: top.$('#addProjectsDataForm').serialize(),
                            success: function (data) {
                                if (data == "success") {
                                    top.$.messager.alert("提示", '修改成功', 'info', function () {
                                        $('#listProjectsTable').datagrid('reload');
                                        top.$('#firstLevelDialog').dialog('close');
                                        //top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                                    });
                                } else if (data == "codeexit") {
                                    top.$.messager.alert('提示', "修改失败！编号已存在", 'error');
                                } else {
                                    top.$.messager.alert('提示', "修改失败！", 'error');
                                }
                            },
                            error: function (res) {

                            }
                        });
                    }
                }

            }
                , {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        top.$('#firstLevelDialog').dialog('close');
                    }
                }],
            onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                //alert(2);
                top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                afterClosed();
            }
        });
        top.$('#firstLevelDialog').dialog("center");
    }

    /**打印验收报告*/
    function printReceivinReport(id) {
        window.open("${ctx}/business/projectmanage/printReceivinReport?projectId=" + id);
    }

    /**
     * 打开归档资料选择页面
     */
    function pigeonhole(id) {//
        top.$('#firstLevelDialog').dialog({
            title: "归档操作",
            iconCls: 'icon-view',
            width: '665',
            height: '525',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/business/projectmanage/leader/pigeonholeInput?projectId=" + id,
            modal: true,
            close: afterClosed,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [
                {
                    text: '一键导出',
                    iconCls: 'icon-ok',
                    handler: function () {
                        /*$.ajax({
                         type:"post",
                         url:"

                        ${ctx}/business/projectmanage/leader/exportAllFile",
                         data:top.$("#pigeonholeForm").serialize(),
                         success:function(data){
                         top.$('#firstLevelDialog').dialog('close');
                         }
                         });*/
                        top.$("#pigeonholeForm").submit();
                        top.$('#firstLevelDialog').dialog('close');

                    }

                }
                ,
                {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        top.$('#firstLevelDialog').dialog('close');
                    }
                }],

        });
        top.$('#firstLevelDialog').dialog("center");
    }

    /*
     *查看结果(中标/流标结果)
     */
    function viewNotifyResult(id) {
        top.$('#firstLevelDialog').dialog({
            title: "查看结果",
            iconCls: 'icon-view',
            width: '1000',
            height: '600',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/business/projectmanage/buyer/viewNotifyResult?projectId=" + id,
            modal: true,
            close: afterClosed,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [
                {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        top.$('#firstLevelDialog').dialog('close');
                    }
                }],

        });
        top.$('#firstLevelDialog').dialog("center");
    }


    //不评标项目 操作
    /**
     *打开编制页面
     */
    function compile(id) {
        top.$('#firstLevelDialog').dialog({
            title: "项目编制",
            iconCls: 'icon-view',
            width: '1000',
            height: '600',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/business/projectNb/buyer/compileInput?projectId=" + id,
            modal: true,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{
                text: '提交',
                id: 'commitEntityBt',
                iconCls: 'icon-ok',
                handler: function () {
                    if (top.$('#addProjectsDataForm').form('validate')) {
                        top.$('#commitEntityBt').linkbutton('disable');
                    }
                    submitCompile();
                }

            }
                , {
                    text: '保存',
                    id: 'addEntityBt',
                    iconCls: 'icon-ok',
                    handler: function () {
                        top.$('#addEntityBt').linkbutton('disable');
                        if (top.$('#addApproveResonForm').form('validate')) {
                            saveCompile();
                        }
                    }

                }
                , {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        top.$('#firstLevelDialog').dialog('close');
                    }
                }],
            onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                afterClosed();
            }
        });
        top.$('#firstLevelDialog').dialog("center");
    }

    /**
     *提交编制
     */
    function submitCompile() {
        loadinginfo();//显示加载框
        if (top.$('#addProjectsDataForm').form('validate')) {//表单校验是否通过
            $.ajax({
                type: "post",
                url: "${ctx}/business/projectNb/buyer/doSubmitCompile?r=" + new Date().getTime(),
                data: top.$("#addProjectsDataForm").serialize(),
                success: function (data) {
                    top.$('#secondtLevelDialog').dialog('close');//隐藏加载框
                    if (data == "success") {
                        top.$.messager.alert("提示", '提交成功', 'info', function () {
                            $('#listProjectsTable').datagrid('reload');
                            $('#listNBProjectsTable').datagrid('reload');
                            top.$('#firstLevelDialog').dialog('close');
                        });
                    } else if (data === "overConfirmDate") {//确认时间晚于服务器当前时间
                        top.$('#commitEntityBt').linkbutton('enable');
                        top.$('#addEntityBt').linkbutton('enable');
                        top.$.messager.alert("提示", '提交失败，确认时间应晚于当前时间!', "error");
                    } else {
                        top.$('#commitEntityBt').linkbutton('enable');
                        top.$('#addEntityBt').linkbutton('enable');
                        top.$.messager.alert("提示", '提交失败!', "error");
                    }
                },
                error: function (data) {
                    top.$('#secondtLevelDialog').dialog('close');//隐藏加载框
                    top.$.messager.alert("提示", '提交失败!', "error");
                    top.$('#commitEntityBt').linkbutton('enable');
                    top.$('#addEntityBt').linkbutton('enable');
                }
            });
        } else {//表单校验不通过
            top.$('#secondtLevelDialog').dialog('close');//隐藏加载框
            top.$.messager.alert('提示', "请将信息填写完整或检查信息填写是否正确后再点击提交!", 'error', function () {
                top.$('#commitEntityBt').linkbutton('enable');
                top.$('#addEntityBt').linkbutton('enable');
            });
        }
    }

    /**
     *保存编制
     */
    function saveCompile() {
        //保存项目
        $.ajax({
            type: "post",
            url: "${ctx}/business/projectNb/buyer/saveCompile?r=" + new Date().getTime(),
            data: top.$("#addProjectsDataForm").serialize(),
            dataType: "text",
            success: function (data) {
                var result = eval("(" + data + ")");
                top.$.messager.alert("提示", '保存成功', 'info', function () {
                    $('#listProjectsTable').datagrid('reload');
                    $('#listNBProjectsTable').datagrid('reload');
                    top.$('#firstLevelDialog').dialog('close');
                });
            },
            error: function (data) {
                top.$.messager.alert("提示", '错误!', "error");
                top.$('#commitEntityBt').linkbutton('enable');
                top.$('#addEntityBt').linkbutton('enable');
            }
        });
    }


    /**
     *校验中标人履约保证金是否缴纳了
     */
    function validHitBond(id) {
        debugger;
        $.ajax({
            type: "POST",
            timeout: 20000,
            url: "${ctx}/business/projectNb/buyer/validBidBond?id=" + id,
            data: {},
            success: function (data) {
                if (data == "ok") {
                    uploadNBContract(id);//打开上传合同页面
                } else {
                    top.$.messager.alert('提示', "中标单位 " + data + "履约保证金未缴纳，请缴纳后再操作！", 'error');
                }
            },
            error: function (res) {

            }
        });
    }


    /**
     * 上传不评标项目合同操作
     */
    function uploadNBContract(id) {
        top.$('#firstLevelDialog').dialog({
            title: "上传合同",
            iconCls: 'icon-view',
            width: '600',
            height: '400',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/business/projectmanage/uploadContract?projectId=" + id,
            modal: true,
            close: afterClosed,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{
                text: '提交',
                iconCls: 'icon-ok',
                id: 'commitEntityBt',
                handler: function () {
                    if (top.$("#budgetMenuData").val() == '') {
                        top.$.messager.alert('提示', "合同附件不能为空！", 'info', function () {
                        });
                        return;
                    }
                    top.$('#commitEntityBt').linkbutton('disable');
                    if (top.$('#addApproveResonForm').form('validate')) {
                        $.ajax({
                            type: "POST",
                            timeout: 20000,
                            url: "${ctx}/business/projectNb/buyer/doSubmitContract",
                            data: top.$('#addCancelResonForm').serialize(),
                            success: function (data) {
                                if (data == "success") {
                                    top.$.messager.alert("提示", '提交成功', 'info', function () {
                                        $('#listProjectsTable').datagrid('reload');
                                        $('#listNBProjectsTable').datagrid('reload');
                                        top.$('#firstLevelDialog').dialog('close');
                                        //top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                                    });
                                } else {
                                    top.$.messager.alert('提示', "提交失败！合同上传失败，请重新上传！", 'info');
                                }
                            },
                            error: function (res) {

                            }
                        });
                    }
                }

            }
                , {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        top.$('#firstLevelDialog').dialog('close');
                    }
                }],
            onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                //alert(2);
                top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                afterClosed();
            }
        });
        top.$('#firstLevelDialog').dialog("center");
    }

    /**
     * 上传不评标项目验收报告
     */
    function uploadReceivingReport(id) {
        top.$('#firstLevelDialog').dialog({
            title: "上传验收报告",
            iconCls: 'icon-view',
            width: '600',
            height: '300',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/business/projectmanage/buyer/receivingReport?projectId=" + id,
            modal: true,
            close: afterClosed,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{
                text: '提交',
                iconCls: 'icon-ok',
                id: 'commitEntityBt',
                handler: function () {
                    if (top.$("#budgetMenuData").val() == '') {
                        top.$.messager.alert('提示', "报告附件不能为空！", 'info', function () {
                        });
                        return;
                    }
                    top.$('#commitEntityBt').linkbutton('disable');
                    if (top.$('#addApproveResonForm').form('validate')) {
                        $.ajax({
                            type: "POST",
                            timeout: 20000,
                            url: "${ctx}/business/projectNb/buyer/uploadReceivingReport",
                            data: top.$('#addCancelResonForm').serialize(),
                            success: function (data) {
                                if (data == "success") {
                                    top.$.messager.alert("提示", '提交成功', 'info', function () {
                                        $('#listProjectsTable').datagrid('reload');
                                        $('#listNBProjectsTable').datagrid('reload');
                                        top.$('#firstLevelDialog').dialog('close');
                                        //top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                                    });
                                } else {
                                    top.$.messager.alert('提示', "提交失败！", 'info');
                                }
                            },
                            error: function (res) {

                            }
                        });
                    }
                }

            }
                , {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        top.$('#firstLevelDialog').dialog('close');
                    }
                }],
            onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                //alert(2);
                top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                afterClosed();
            }
        });
        top.$('#firstLevelDialog').dialog("center");
    }

    /**
     * 打印不评标验收报告
     * @param id
     */
    function printNBReceivinReport(id) {
        top.$('#firstLevelDialog').dialog({
            title: "验收报告",
            iconCls: 'icon-view',
            width: '665',
            height: '325',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/business/projectNb/printReceivinReport?projectId=" + id + "&isShow=false",
            modal: true,
            close: afterClosed,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{
                text: '取消',
                iconCls: 'icon-cancel',
                handler: function () {
                    top.$('#firstLevelDialog').dialog('close');
                }
            }],

        });
        top.$('#firstLevelDialog').dialog("center");
    }


    /**
     *选择中标单位
     */
    function choiceBidders(id) {
        top.$('#firstLevelDialog').dialog({
            title: "中标选择",
            iconCls: 'icon-view',
            width: '800',
            height: '500',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/business/projectNb/centerAuditor/choiceBidders?projectId=" + id,
            modal: true,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{

                id: 'commitEntityBt',
                text: '结束选择',
                iconCls: 'icon-ok',
                handler: function () {
//                        if(top.$("#budgetMenuData").val()==''){
//                            top.$.messager.alert('提示',"报告附件不能为空！",'info',function(){});
//                            return;
//                        }
                    var isFinishAfterAudit = top.$('input:radio[name="isFinishAfterAudit"]:checked').val();
                    if (isFinishAfterAudit == "false") {
                        top.$.messager.alert('提示', "未完成资格候审，无法提交！", 'info', function () {
                        });
                        return;
                    }
                    top.$('#commitEntityBt').linkbutton('disable');
                    loadinginfo();//显示加载框
                    $.ajax({
                        type: "post",
                        url: "${ctx}/business/projectNb/buyer/afterChooseBidder?r=" + new Date().getTime(),
                        data: {
                            projectId: id,
                            budgetMenuData: top.$("#budgetMenuData").val(),
                            isFinishAfterAudit: isFinishAfterAudit

                        },
                        success: function (data) {
                            //  alert("返回的数据 ："+data);
                            top.$('#secondtLevelDialog').dialog('close');//隐藏加载框
                            if (data == "success") {
                                top.$.messager.alert("提示", '提交成功', 'info', function () {
                                    $('#listProjectsTable').datagrid('reload');
                                    $('#listNBProjectsTable').datagrid('reload');
                                    top.$('#firstLevelDialog').dialog('close');
                                });
                            } else if (data == "noChoose") {
                                top.$.messager.alert("提示", '请先选择中标结果', 'info', function () {
                                    top.$('#commitEntityBt').linkbutton('enable');
                                });
                            } else if (data == "supplementFile") {
                                top.$.messager.alert("提示", '查看评审纪要是否上传!', "info");
                                top.$('#commitEntityBt').linkbutton('enable');
                            }
                            else {
                                top.$.messager.alert("提示", '提交失败!', "error");
                            }
                        },
                        error: function (data) {
                            top.$('#secondtLevelDialog').dialog('close');//隐藏加载框
                            top.$.messager.alert("提示", '提交失败!', "error");
                        }
                    });

                }
            }, {
                text: '取消',
                iconCls: 'icon-cancel',
                handler: function () {
                    top.$('#firstLevelDialog').dialog('close');
                }
            }]
            , onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                top.$("#uploadify1").uploadify('destroy');//销毁文件上传对象....
                afterClosed();
            }
        });
        top.$('#firstLevelDialog').dialog("center");
    }


    /**
     * 发放中标通知书
     */
    function noticBidInfo(id) {
        top.$.messager.confirm('提示', "您确认要发放本项目中标通知书、项目合同吗？", function (result) {
            if (result) {
                $.ajax({
                    type: "post",
                    url: "${ctx}/business/projectNb/centerAuditor/noticBidInfo?id=" + id,
                    success: function (data, res) {
                        var result = $.trim(res.responseText);
                        if (result == "unLogin") {
                            var msn = '' || i18n[''];
                            msn = msn || i18n[result];
                            if (msn != undefined) {
                                top.$.messager.alert('提示', msn, 'info', function () {
                                    top.location = '${ctx}/user-login-sys-new/loginPwd';
                                });
                                return;
                            }
                        }
                        top.$.messager.alert("提示", '请联系财务管理员于5个工作日内退还非中标人投标保证金!', 'info', function () {
                            $('#listProjectsTable').datagrid('reload');
                            $('#listNBProjectsTable').datagrid('reload');

                        });

                    },
                    error: function (res) {
                        $.messager.alert('提示', i18n.requestError, 'error');
                    }
                });
            }
        });
    }

    /**
     * 评标之后补录资料
     */
    function supplementFile(id) {
        top.$('#firstLevelDialog').dialog({
            title: "补录资料",
            iconCls: 'icon-view',
            width: '900',
            height: '500',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/business/projectNb/supplementFile?projectId=" + id,
            modal: true,
            close: afterClosed,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{
                text: '提交',
                iconCls: 'icon-ok',
                handler: function () {
                    if (top.$('#addDataForm').form('validate')) {//表单校验是否通过
                        //alert("提交按钮操作");
                        $.ajax({
                            type: "post",
                            url: "${ctx}/business/projectNb/doSupplementFile?r=" + new Date().getTime(),
                            data: top.$("#addDataForm").serialize(),
                            success: function (data) {
                                if (data == "success") {
                                    //top.$(".upload").uploadify('destroy');//销毁文件上传对象....
                                    top.$.messager.alert("提示", '提交成功', 'info', function () {
                                        $('#listProjectsTable').datagrid('reload');
                                        $('#listNBProjectsTable').datagrid('reload');
                                        top.$('#firstLevelDialog').dialog('close');
                                    });
                                }
                                else {
                                    top.$.messager.alert("提示", '提交失败!', "error");
                                }
                            },
                            error: function (data) {
                                top.$.messager.alert("提示", '提交失败!', "error");
                            }
                        });
                    }

                }
            },
                {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        top.$('#firstLevelDialog').dialog('close');
                    }
                }],
            onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                top.$(".uploadify").each(function () {
                    var uploadId = $(this).parent().parent().find(".uploadify").attr("id");
                    top.$("#" + uploadId).uploadify('destroy');//销毁文件上传对象....
                });
                afterClosed();
            }
        });
        top.$('#firstLevelDialog').dialog("center");
    }


    /**
     * 补录流标资料
     */
    function uploadFlowFile(id) {
        top.$('#firstLevelDialog').dialog({
            title: "流标补录资料",
            iconCls: 'icon-view',
            width: '900',
            height: '500',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/business/projectNb/uploadFlowFile?projectId=" + id,
            modal: true,
            close: afterClosed,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{
                text: '提交',
                iconCls: 'icon-ok',
                handler: function () {
                    if (top.$('#addDataForm').form('validate')) {//表单校验是否通过
                        //alert("提交按钮操作");
                        $.ajax({
                            type: "post",
                            url: "${ctx}/business/projectNb/buyer/afterFlowDownUpFile?r=" + new Date().getTime(),
                            data: top.$("#addDataForm").serialize(),
                            success: function (data) {
                                if (data == "success") {
                                    //top.$(".upload").uploadify('destroy');//销毁文件上传对象....
                                    top.$.messager.alert("提示", '提交成功', 'info', function () {
                                        $('#listProjectsTable').datagrid('reload');
                                        $('#listNBProjectsTable').datagrid('reload');
                                        top.$('#firstLevelDialog').dialog('close');
                                    });
                                } else if (data == "supplementFile") {
                                    top.$.messager.alert("提示", '请上传评审纪要！', "error");
                                }
                                else {
                                    top.$.messager.alert("提示", '提交失败!', "error");
                                }
                            },
                            error: function (data) {
                                top.$.messager.alert("提示", '提交失败!', "error");
                            }
                        });
                    }

                }
            },
                {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        top.$('#firstLevelDialog').dialog('close');
                    }
                }],
            onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                top.$(".uploadify").each(function () {
                    var uploadId = $(this).parent().parent().find(".uploadify").attr("id");
                    top.$("#" + uploadId).uploadify('destroy');//销毁文件上传对象....
                });
                afterClosed();
            }
        });
        top.$('#firstLevelDialog').dialog("center");
    }


    /**打印中标通知书**/
    function printWinbidAlert(id) {
        top.$('#firstLevelDialog').dialog({
            title: "中标通知书",
            iconCls: 'icon-view',
            width: '665',
            height: '325',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/business/projectNb/printWinbidAlert?projectId=" + id + "&isShow=false",
            modal: true,
            close: afterClosed,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{
                text: '取消',
                iconCls: 'icon-cancel',
                handler: function () {
                    top.$('#firstLevelDialog').dialog('close');
                }
            }],

        });
        top.$('#firstLevelDialog').dialog("center");
    }

    function validBudgetAmount() {
        var value = top.$("#catagoryId").combobox("getValue");
        var budgetAmount = top.$("#budgetAmount").val();
        if (value == "297edff854087daf01540d5cef8b0004") {//工程类
            if (budgetAmount >= 1000000) {
                top.$.messager.alert('提示', "工程类项目限额小于100万", 'info', function () {
                    top.$("#budgetAmount").val("");

                });
                return false;
            } else {
                return true;
            }
        }
        if (value == "0000000056a29c3a0156a2e80cf4006c") {//货物类型
            if (budgetAmount >= 500000) {
                top.$.messager.alert('提示', "货物类项目限额小于50万", 'info', function () {
                    top.$("#budgetAmount").val("");
                });
                return false;
            } else {
                return true;
            }
        }
        if (value == "540d5cef8b0004f000000056a29c3a01") {//服务类
            if (budgetAmount >= 300000) {
                top.$.messager.alert('提示', "服务类项目限额小于30万", 'info', function () {
                    top.$("#budgetAmount").val("");
                });
                return false;
            } else {
                return true;
            }
        }
    }


    /**
     * 产权人确认项目
     */
    function confirmResult(id, obj) {
        top.$('#firstLevelDialog').dialog({
            title: $(obj).text(),
            iconCls: 'icon-view',
            width: '600',
            height: '500',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/auctionBid/business/owner/confirmResult?projectId=" + id,
            modal: true,
            close: afterClosed,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{
                text: '提交',
                iconCls: 'icon-ok',
                id: 'commitEntityBt',
                handler: function () {
                    var val = top.$("input[name='status']:checked").val();
                    if (val >= 1 && $.trim(top.$("#confirmReason").val()) == '') {
                        top.$.messager.alert('提示', "请填写原因！", 'info', function () {
                        });
                        return;
                    }
                    var historyAttrCount = top.$("#resDataList div").length;//评审纪要已记录的附件
                    var uploadedCount = top.$("#fileQueue11 .cancel").length;//评审纪要以保存但为绑定的附件

                    if (historyAttrCount <= 0 && uploadedCount <= 0) {
                        top.$.messager.alert('提示', "评审纪要附件不能为空！", 'info', function () {
                        });
                        return;
                    }
                    top.$('#commitEntityBt').linkbutton('disable');
                    if (top.$('#addApproveResonForm').form('validate')) {
                        loadinginfo();//显示加载框
                        $.ajax({
                            type: "POST",
                            timeout: 20000,
                            url: "${ctx}/auctionBid/business/owner/confirmProject",
                            data: top.$('#addCancelResonForm').serialize(),
                            success: function (data) {
                                top.$('#secondtLevelDialog').dialog('close');//隐藏加载框
                                if (data == "success") {
                                    top.$.messager.alert("提示", '操作成功', 'info', function () {
                                        $('#listProjectsTable').datagrid('reload');
                                        $('#listNBProjectsTable').datagrid('reload');
                                        top.$('#firstLevelDialog').dialog('close');
                                        //top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                                    });
                                } else {
                                    top.$.messager.alert('提示', "操作失败！", 'info');
                                }
                            },
                            error: function (res) {
                                top.$('#secondtLevelDialog').dialog('close');//隐藏加载框
                            }
                        });
                    }
                }
            }
                , {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        top.$('#firstLevelDialog').dialog('close');
                    }
                }],
            onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                //alert(2);
                top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                top.$(".fileQueue").uploadify('destroy');//销毁文件上传对象....
                afterClosed();
            }
        });
        top.$('#firstLevelDialog').dialog("center");
    }

    /**
     *校验中标人是否缴纳竞价的履约保证金
     **/
    function validAuctionBidBond(id) {
        $.ajax({
            type: "POST",
            timeout: 20000,
            url: "${ctx}/auctionBid/business/validBidBond?auctionInfoId=" + id,
            data: {},
            success: function (data) {
                if (data == true) {
                    uploadAuctionContract(id);//打开上传合同页面
                } else {
                    top.$.messager.alert('提示', "中标人履约保证金未缴纳，请缴纳后再操作！", 'error');
                }
            },
            error: function (res) {

            }
        });
    }

    //校验时间格式
    function RQcheck(RQ) {
        var date = RQ;
        var result = date.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/);
        if (result == null)
            return false;
        var d = new Date(result[1], result[3] - 1, result[4]);
        return (d.getFullYear() == result[1] && (d.getMonth() + 1) == result[3] && d.getDate() == result[4]);
    }

    //时间比较
    function compareDate(date1, oDate2) {
        var oDate1 = new Date(date1);
        if (oDate1.getTime() > oDate2.getTime()) {
            return true;
        } else {
            return false;
        }
    }


    /**
     * 上传合同操作
     */
    function uploadAuctionContract(id) {
        top.$('#firstLevelDialog').dialog({
            title: "上传合同",
            iconCls: 'icon-view',
            width: '600',
            height: '400',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/auctionBid/business/owner/uploadAuctionContract?projectId=" + id,
            modal: true,
            close: afterClosed,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [{
                text: '提交',
                iconCls: 'icon-ok',
                id: 'commitEntityBt',
                handler: function () {
                    var resDataListCount = top.$("#resDataList div").length;//合同附件已记录的附件
                    var uploadedCount = top.$("#fileQueue13 .cancel").length;//合同附件以保存但为绑定的附件
                    var isBackTime = top.$("#isBackTime");

                    //判断是否是中心托管项目
                    if (isBackTime.is(":hidden") == false) {
                        var backTime = $.trim(top.$('#backTime').datebox('getValue'));
                        if (backTime.length <= 0) {
                            top.$.messager.alert('提示', "履约保证金退还时间,不能为空！", 'info', function () {
                            });
                            return;
                        }
                        if (RQcheck(backTime) == false) {
                            top.$.messager.alert('提示', "履约保证金退还时间,时间格式不正确！", 'info', function () {
                            });
                            return;
                        }
                        if (compareDate(backTime,new Date()) == false) {
                            top.$.messager.alert('提示', "履约保证金退还时间,不能小于当前时间！", 'info', function () {
                            });
                            return;
                        }
                    }
                    if (resDataListCount <= 0 && uploadedCount <= 0) {
                        top.$.messager.alert('提示', "合同附件不能为空！", 'info', function () {
                        });
                        return;
                    }
                    var otherResDataListCount = top.$("#otherResDataList div").length;//合同附件已记录的附件
                    var otherUploadedCount = top.$("#fileQueue14 .cancel").length;//合同附件以保存但为绑定的附件
                    if (otherResDataListCount <= 0 && otherUploadedCount <= 0) {
                        top.$.messager.alert('提示', "中标通知书附件不能为空！", 'info', function () {
                        });
                        return;
                    }
                    top.$('#commitEntityBt').linkbutton('disable');
                    if (top.$('#addApproveResonForm').form('validate')) {
                        $.ajax({
                            type: "POST",
                            timeout: 20000,
                            url: "${ctx}/auctionBid/business/owner/doSubmitContract",
                            data: top.$('#addCancelResonForm').serialize(),
                            success: function (data) {
                                if (data == "success") {
                                    top.$.messager.alert("提示", '提交成功', 'info', function () {
                                        $('#listProjectsTable').datagrid('reload');
                                        top.$('#firstLevelDialog').dialog('close');
                                        //top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                                    });
                                } else {
                                    top.$.messager.alert('提示', "提交失败！合同上传失败，请重新上传！", 'info');
                                }
                            },
                            error: function (res) {

                            }
                        });
                    }
                }

            }
                , {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        top.$('#firstLevelDialog').dialog('close');
                    }
                }],
            onClose: function () {// 解决IE浏览器中无法移除object标签，导致上传插件的flash无法使用，所有的dialog都会出现问题
                //alert(2);
                top.$("#uploadify").uploadify('destroy');//销毁文件上传对象....
                top.$(".fileQueue").uploadify('destroy');//销毁文件上传对象....

                afterClosed();
            }
        });
        top.$('#firstLevelDialog').dialog("center");
    }

    /**
     * 发放中标通知书
     */
    function sendNoticBidInfo(projectId) {
        top.$.messager.confirm('提示', "您确认要发放本项目中标通知书？", function (result) {
            if (result) {
                $.ajax({
                    type: "post",
                    url: "${ctx}/auctionBid/business/centerAuditor/noticBidInfo?projectId=" + projectId,
                    success: function (data, res) {
                        var result = $.trim(res.responseText);
                        if (result == "unLogin") {
                            var msn = '' || i18n[''];
                            msn = msn || i18n[result];
                            if (msn != undefined) {
                                top.$.messager.alert('提示', msn, 'info', function () {
                                    top.location = '${ctx}/user-login-sys-new/loginPwd';
                                });
                                return;
                            }
                        }
                        top.$.messager.alert("提示", '操作成功!', 'info', function () {
                            $('#listProjectsTable').datagrid('reload');
                        });

                    },
                    error: function (res) {
                        $.messager.alert('提示', i18n.requestError, 'error');
                    }
                });
            }
        });
    }

    /**打印中标通知书**/
    function viewPrintWinbidAlert(id) {
        window.open("${ctx}/auctionBid/business/viewPrintWinbidAlert?projectId=" + id + "&isShow=false");
    }

    /*
     *预览公告(中标/流标结果)
     */
    function previewWinnerNotice(id) {
        top.$('#firstLevelDialog').dialog({
            title: "预览公告",
            iconCls: 'icon-view',
            width: '1000',
            height: '600',
            closed: false,
            inline: true,
            cache: false,
            href: "${ctx}/auctionBid/business/owner/previewWinnerNotice?projectId=" + id,
            modal: true,
            close: afterClosed,
            extractor: function (data) {
                if ($.trim(data) == "unLogin") {
                    var msn = '' || i18n[''];
                    msn = msn || i18n[data];
                    if (msn != undefined) {
                        top.$.messager.alert('提示', msn, 'info', function () {
                            top.location = '${ctx}/user-login-sys-new/loginPwd';
                        });
                        return '';
                    }
                }
                return data;
            },
            buttons: [
                {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        top.$('#firstLevelDialog').dialog('close');
                    }
                }],

        });
        top.$('#firstLevelDialog').dialog("center");
    }
</script>